package test;

import com.lmax.disruptor.dsl.Disruptor;

import java.util.concurrent.Executors;

/**
 * @author : gameZhao
 * @version V1.0
 * @Project: disruptorDemo
 * @Package test
 * @Description: TODO
 * @date Date : 2021年12月29日 14:27
 */
public class DisruptorMain {
    
    public void start(){
        Disruptor disruptor = new Disruptor(DataEvent::new, 1024,Executors.defaultThreadFactory());
        disruptor.handleEventsWith(new DataEventHandler());
        disruptor.start();
        var ringBuffer = disruptor.getRingBuffer();
        var sequence = ringBuffer.next();
        ringBuffer.publish(sequence);
    }
}
